package com.nus.dataaccess.dao.conference;

import com.nus.dataaccess.dao.base.BaseEntity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author T W Ong
 */

@Entity
@Table(name="CONFERENCE_ITEM")
public class ConferenceItem extends BaseEntity{
    
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;
    public Long getId() {return id;}
    public void setId(Long id) {this.id = id;}
    @Override
    public Serializable getPk() {return this.getId();}
    
    @Column(name="TYPE")
    private String type;
    public String getType() {return type;}
    public void setType(String type) {this.type = type;}
    
    @Column(name="FILE_NAME")
    private String fileName;
    public String getFileName() {return fileName;}
    public void setFileName(String fileName) {this.fileName = fileName;}
    
    @Column(name="KEY_WORD")
    private String keyWord;
    public String getKeyWord() {return keyWord;}
    public void setKeyWord(String keyWord) {this.keyWord = keyWord;}
        
    @Column(name="FILE_BINARY" , columnDefinition="blob")
    @Lob
    private byte[] fileBinary;
    public byte[] getFileBinary() {return fileBinary;}
    public void setFileBinary(byte[] fileBinary) {this.fileBinary = fileBinary;}
    
    @Column(name="CONFERENCE_AUTHOR_ID")
    private Long conferenceAuthorId;
    public Long getConferenceAuthorId() {return conferenceAuthorId;}
    public void setConferenceAuthorId(Long conferenceAuthorId) {this.conferenceAuthorId = conferenceAuthorId;}
    
    @ManyToOne
    @JoinColumn(name="CONFERENCE_AUTHOR_ID", referencedColumnName="ID",insertable=false,updatable=false)
    private ConferenceAuthor conferenceAuthor;
    public ConferenceAuthor getConferenceAuthor() {return conferenceAuthor;}
    public void setConferenceAuthor(ConferenceAuthor conferenceAuthor) {
        this.conferenceAuthor = conferenceAuthor;
        this.setConferenceAuthorId((conferenceAuthor == null) ? null : conferenceAuthor.getId());
    }

   
}
